package com.sskj.fca.presenter;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.lib.http.JsonCallBack;
import com.sskj.fca.bean.CommonBean;
import com.sskj.fca.http.HttpConfig;
import com.sskj.fca.ui.fragment.DownloadFragment;

/**
 * Created by QinKang on 2018/12/29.
 */

public class DownloadFragmentPresenter extends BasePresenter<DownloadFragment> {
    /**
     * 公共数据--获取下载地址
     */
    public void getCommonData() {
        httpService.getCommonData()
                .tag(this)
                .execute(new JsonCallBack<HttpData<CommonBean>>(this) {
                    @Override
                    public void onSuccess(Response<HttpData<CommonBean>> response) {
                        HttpData httpData = response.body();
//                        ToastUtil.showShort(httpData.msg);
                        if (httpData.getStatus() == HttpConfig.OK) {
                            mView.updataUI((CommonBean) httpData.getData());
                        }
                    }
                });
    }
}
